package com.zfx.mapper;

import com.zfx.pojo.User;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import javax.persistence.Column;
import java.util.List;

/**
 * @description:
 * @author: zfx
 * @version: 1.0
 * @time: 2020-05-08 0:51
 * <p>
 * 修改历史：
 * 修改日期      修改人员    版本    内容
 * 2020-05-08   zfx       1.0
 */
public interface IUserMapper extends Mapper<User> {

    @Select("<script>select * from tbs_user where 1=1 " +
            "<if test='username != null' > and username like #{username}</if>" +
            "<if test='phone != null' > and phone like #{phone}</if>" +
            "<if test='tag != null' > and tag like #{tag}</if></script>")
    List<User> findByUser(User user);

    @Select("<script>select count(*) from tbs_user where 1=1 " +
            "<if test='username != null' > and username like #{username}</if>" +
            "<if test='phone != null' > and phone like #{phone}</if>" +
            "<if test='tag != null' > and tag like #{tag}</if></script>")
    int countByUser(User user);
}
